Skip to content

Google java formatter with spotless#686

Merged
ericbuckley merged 3 commits intomainfrom
eb/app-342/java-formatter
Mar 10, 2026
Merged

Google java formatter with spotless#686
ericbuckley merged 3 commits intomainfrom
eb/app-342/java-formatter

Conversation

@ericbuckley
Copy link
Contributor

Description

This pull request integrates the Spotless plugin with Google Java Format to automatically enforce consistent code styling across the project. It also introduces a new GitHub Actions workflow to verify formatting on all pull requests targeting the main branch.

Related Issues

APP-342

Additional Notes

The Spotless Gradle plugin was introduced to automate code formatting, which guarantees consistent style and reduces developer overhead. Consequently, existing Java files within the liquibase-service were automatically reformatted to match the newly enforced Google Java Format rules.

  • Added the com.diffplug.spotless plugin (v8.3.0) to build.gradle and configured it to use googleJavaFormat().
  • Bound the spotlessApply task to run automatically before compileJava.
  • Created .github/workflows/verify-formatting.yaml to run spotlessCheck in the CI pipeline.
  • Updated README.md with instructions on how developers can use Spotless locally to format their code.
  • Reformatted existing classes and unit tests in the liquibase-service to align with the new 2-space indentation and formatting standards.

Checklist

  • I have ensured that the pull request is of a manageable size, allowing it to be reviewed within a single session.
  • I have reviewed my changes to ensure they are clear, concise, and well-documented.
  • I have updated the documentation, if applicable.
  • I have added or updated test cases to cover my changes, if applicable.

Integrate the Spotless Gradle plugin to enforce consistent Java code
style using Google Java Format across all subprojects.

Key changes:
- Configure Spotless for Java with Google Java Format and cleanup rules.
- Implement incremental formatting using 'ratchetFrom' to target only
  new changes by default.
- Add a GitHub Action workflow to verify formatting on pull requests.
- Update documentation with instructions for local usage and targeted
  formatting of specific files.
Reformatting just the liquibase-service java files to confirm the
settings and workflow are working.
@ericbuckley ericbuckley self-assigned this Mar 6, 2026
@ericbuckley ericbuckley marked this pull request as ready for review March 6, 2026 22:18
@ericbuckley ericbuckley requested a review from a team as a code owner March 6, 2026 22:18
Copy link
Contributor

@hawley-skylight hawley-skylight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!

@ericbuckley ericbuckley merged commit f3b8367 into main Mar 10, 2026
2 checks passed
@ericbuckley ericbuckley deleted the eb/app-342/java-formatter branch March 12, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants